home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / cg / boxmaker.rexx < prev    next >
OS/2 REXX Batch file  |  1996-02-21  |  2KB  |  83 lines

  1. /* BoxMaker -- Save Boxes to rexx macro                    */
  2. /* By Bob Caron  On 12/24/1994 NewTek, Inc.                */
  3. /* <It's fun to code while people argue outside your office*/
  4. /*  try it sometime!>                                      */
  5.  
  6. call addlib(CG_AREXX,0)
  7.  
  8. filnam = 'ENV:BoxMaker.state'
  9. version = 'BoxMaker v1.4'
  10.  
  11. if (exists(filnam)) then do
  12.     if (~open(state, filnam, 'R')) then break
  13.     if (readln(state) ~= version) then break
  14.     file=readln(state)
  15.     end
  16.     call close state
  17.  
  18. if file="FILE" | file="" then
  19.    file="Toaster:Arexx/CG/BoxMakerScripts/Boxes.rexx"
  20.  
  21. if lastpos('/',file,length(file)-1)~=0 then do
  22.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  23.    path=left(file,(lastpos('/',file,length(file))-1))
  24.    end
  25. else do
  26.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  27.    path=left(file,(lastpos(':',file,length(file))))
  28.    end
  29.  
  30. outfile=REQ_FILE("Save Box Attributes As...",filenam,path)
  31.  
  32. if outfile="" then
  33.    exit
  34.  
  35. file=script
  36. if (open(state, filnam, 'W')) then do
  37.     call writeln state, version
  38.     call writeln state, outfile
  39.     call close state
  40. end
  41.  
  42. if exists(outfile) then do
  43.    x=req_ask("Write Over File '"||outfile||"'?")
  44.    if x=0 then do
  45.       x=req_tell("Canceled")
  46.       exit
  47.       end
  48.    end
  49.  
  50. if (~open(outfd,outfile,W)) then do
  51.      call REQ_TELL("Can't open output:",outfile)
  52.      exit
  53.      end
  54.  
  55.    writeln(outfd,"/* "||outfile" -- A Box Attribute Setter*/")
  56.    writeln(outfd,"/* By A. Random User ©1994 NewTek, Inc. */")
  57.    writeln(outfd,"/* (Based on a program by Bob Caron.)   */")
  58.    writeln(outfd,"")
  59.    writeln(outfd,"call addlib(CG_AREXX,0)")
  60.    writeln(outfd,"")
  61.    writeln(outfd,"call pickpage(not)")
  62.    writeln(outfd,"call set_char(face,commonthin.10)")
  63.    current_line=1
  64.    total_lines=GET_PAGE(SIZE)
  65.    do while current_line <= total_lines
  66.       call SET_LINE(current_line)
  67.       line_pos=GET_LINE(SPOT)
  68.       current_line=current_line+1
  69.       boxspot=translate(GET_RECT(SPOT),","," ")
  70.       boxsize=translate(GET_RECT(SIZE),","," ")
  71.       if boxsize~="0,0" & boxspot~="0,0" then do
  72.          writeln(outfd,"CALL MAKELINE()") /* This is ugly but it works       */
  73.          writeln(outfd,"CALL MAKELINE()") /* Just a problem with CG Arexx ;) */
  74.          writeln(outfd,"CALL MAKERECT("||boxspot||","||boxsize||")")
  75.          end
  76.    end
  77.    writeln(outfd,"CALL REMLIB(CG_AREXX)")
  78.    call close(outfd)
  79.    call REQ_TELL("Saved...")
  80.    call REMLIB(CG_AREXX)
  81. exit
  82.  
  83.